import QtQuick 2.0
import QtQuick.Controls 2.5

Item {
    width: 850
    height: 580

    signal qmlSN_sqlWriteFinish()
    onQmlSN_sqlWriteFinish: {
        if(!focus && $sqlMcRecorder.qml_getRefurbishFlag()) return
        if($sqlMcRecorder.qml_getPrintFlag()) console.log("->page5 operater start")
        //0-过励限制
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","过励限制")===true) page_5LimiterStatu_A.children[1].children[0].checked = true;
        else page_5LimiterStatu_A.children[1].children[0].checked = false;
        //1-过励限制到达
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","强励限制")===true) page_5LimiterStatu_A.children[1].children[1].checked = true;
        else page_5LimiterStatu_A.children[1].children[1].checked = false;
        //2-欠励限制
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","欠励限制")===true) page_5LimiterStatu_A.children[1].children[2].checked = true;
        else page_5LimiterStatu_A.children[1].children[2].checked = false;
        //3-V/F限制
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","VF限制")===true) page_5LimiterStatu_A.children[1].children[3].checked = true;
        else page_5LimiterStatu_A.children[1].children[3].checked = false;
        //5-定子电流限制
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","定子电流限制")===true) page_5LimiterStatu_A.children[1].children[4].checked = true;
        else page_5LimiterStatu_A.children[1].children[4].checked = false;
        //6-定子电流限制值达到
//        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","定子电流限制值达到")===true) page_5LimiterStatu_A.children[1].children[5].checked = true;
//        else page_5LimiterStatu_A.children[1].children[5].checked = false;
        //7-过无功限制
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","过无功限制")===true) page_5LimiterStatu_A.children[1].children[6].checked = true;
        else page_5LimiterStatu_A.children[1].children[6].checked = false;
        //8-最小励磁电流限制
        if($sqlMcRecorder.qml_getBitBool("A套","调节器故障","最小励磁电流限制")===true) page_5LimiterStatu_A.children[1].children[7].checked = true;
        else page_5LimiterStatu_A.children[1].children[7].checked = false;


        //0-过励限制
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","过励限制")===true) page_5LimiterStatu_B.children[1].children[0].checked = true;
        else page_5LimiterStatu_B.children[1].children[0].checked = false;
        //1-过励限制到达
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","强励限制")===true) page_5LimiterStatu_B.children[1].children[1].checked = true;
        else page_5LimiterStatu_B.children[1].children[1].checked = false;
        //2-欠励限制
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","欠励限制")===true) page_5LimiterStatu_B.children[1].children[2].checked = true;
        else page_5LimiterStatu_B.children[1].children[2].checked = false;
        //3-V/F限制
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","VF限制")===true) page_5LimiterStatu_B.children[1].children[3].checked = true;
        else page_5LimiterStatu_B.children[1].children[3].checked = false;
        //5-定子电流限制
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","定子电流限制")===true) page_5LimiterStatu_B.children[1].children[4].checked = true;
        else page_5LimiterStatu_B.children[1].children[4].checked = false;
        //6-定子电流限制值达到
//        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","定子电流限制值达到")===true) page_5LimiterStatu_B.children[1].children[5].checked = true;
//        else page_5LimiterStatu_B.children[1].children[5].checked = false;
        //7-过无功限制
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","过无功限制")===true) page_5LimiterStatu_B.children[1].children[6].checked = true;
        else page_5LimiterStatu_B.children[1].children[6].checked = false;
        //8-最小励磁电流限制
        if($sqlMcRecorder.qml_getBitBool("B套","调节器故障","最小励磁电流限制")===true) page_5LimiterStatu_B.children[1].children[7].checked = true;
        else page_5LimiterStatu_B.children[1].children[7].checked = false;

        if($sqlMcRecorder.qml_getPrintFlag()) console.log("->page5 operater stop")
    }
    Component.onCompleted: {
        var list = page_5LimiterStatu_A.p5s_gridLayout.children;
        for(var i in list)
            console.log("name: "+list[i]+" checked:"+list[i].checked)
    }

    SwipeView{
        id:swipeView_this
        orientation: Qt.Horizontal
        clip: true
        currentIndex: 0
        width: parent.width
        height: parent.height*0.8

        Item {
            id: firstPage
            Page_05LimiterStatu_SingleChannle {
                id: page_5LimiterStatu_A
                width: swipeView_this.width
                height: swipeView_this.height
                titleText:qsTr("A通道限制动作状态")
                p5s_gridLayout.rows: 4
                p5s_gridLayout.columns: 2
                checkBoxNum: 8
                Component.onCompleted: {
                    p5s_gridLayout.children[0].text="过励限制"
                    p5s_gridLayout.children[1].text="过励限制值达到"
                    p5s_gridLayout.children[2].text="欠励限制"
                    p5s_gridLayout.children[3].text="V/F限制"
                    p5s_gridLayout.children[4].text="定子电流限制"
                    p5s_gridLayout.children[5].text="定子电流限制值达到"
                    p5s_gridLayout.children[6].text="过无功限制"
                    p5s_gridLayout.children[7].text="最小励磁电流限制"
                }
            }
        }
        Item {
            id: secondPage
            Page_05LimiterStatu_SingleChannle {
                id: page_5LimiterStatu_B
                width: swipeView_this.width
                height: swipeView_this.height
                titleText:qsTr("B通道限制动作状态")
                p5s_gridLayout.rows: 4
                p5s_gridLayout.columns: 2
                checkBoxNum: 8
                Component.onCompleted: {
                    p5s_gridLayout.children[0].text="过励限制"
                    p5s_gridLayout.children[1].text="过励限制值达到"
                    p5s_gridLayout.children[2].text="欠励限制"
                    p5s_gridLayout.children[3].text="V/F限制"
                    p5s_gridLayout.children[4].text="定子电流限制"
                    p5s_gridLayout.children[5].text="定子电流限制值达到"
                    p5s_gridLayout.children[6].text="过无功限制"
                    p5s_gridLayout.children[7].text="最小励磁电流限制"
                }
            }
        }

        onCurrentIndexChanged: {
            if(swipeView_this.currentIndex==0){
                p5_button.checked = true
                p5_button2.checked = false
            }
            else{
                p5_button.checked = false
                p5_button2.checked = true
            }
        }
    }

    EXC_Normal_BtnSytle {
        id: p5_button
        nameText: qsTr("A通道限制状态")
        width: parent.width*0.27
        height: parent.height*0.09
        checked: true
        anchors.left: parent.left
        anchors.leftMargin: parent.width*0.2
        anchors.topMargin: parent.height/20
        anchors.top: swipeView_this.bottom
        onClicked: {
            if(swipeView_this.currentIndex==0)
                checked = true;
            else
                swipeView_this.currentIndex = 0
        }
    }

    EXC_Normal_BtnSytle {
        id: p5_button2
        nameText: qsTr("B通道限制状态")
        width: parent.width*0.27
        height: parent.height*0.09
        anchors.left: parent.left
        anchors.leftMargin: parent.width*0.6
        anchors.topMargin: parent.height/20
        anchors.top: swipeView_this.bottom
        onClicked: {
            if(swipeView_this.currentIndex==1)
                checked = true;
            else
                swipeView_this.currentIndex = 1
        }
    }

}

/*##^##
Designer {
    D{i:0;formeditorZoom:0.5}
}
##^##*/
